import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        System.out.println(getC("jdbc:mysql://localhost:3306/mjs", "root", "182728"));
    }

    private static Connection getC(String url,String user,String password) throws ClassNotFoundException, SQLException {
        Connection conn = null;
        Class.forName("com.mysql.jdbc.Driver");
        conn = DriverManager.getConnection(url,user,password);
        return conn;
    }
}
